﻿{include file="common/header" /}
<link rel="stylesheet" href="__STATIC__/static/css/warehouse.css?v={{:config('STATIC_VERSION')}}">
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	仓库管理 <span class="c-gray en">&gt;</span>
	仓库管理
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
	    <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>
<div class="page-container" style="position: relative;">
	<form class="text-c layui-form"  id="myform" method="post"  >

	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a href="javascript:;" onclick="add('添加仓库权限','{{:url('/warehouse/create_manage')}}','800','500')" class="btn btn-primary radius">
				<i class="Hui-iconfont"></i> 添加仓库权限</a></span>

	</div>
	<table class="table table-border table-bordered table-bg mt-20" >
		<thead>
			<tr>
				<th scope="col" colspan="9">员工列表</th>
			</tr>
			<tr class="text-c">
				<th>英文名</th>
				<th>仓库</th>
			</tr>
		</thead>
		<tbody id="tbody" >
		{volist name="data" id="vo"}
		   <tr class="text-c">
			   <td>{{$vo.UserName}}</td>
			   <td>
				   {foreach $vo.WareHouse as $k=>$v }
				   <span class="warehouse-items">{{$v}} <i data-userid="{{$key}}" data-warehouse="{{$v}}"></i> </span>
				   {/foreach}
			   </td>
		   </tr>
		{/volist}
		</tbody>
	</table>

</div>
<script>
	function add(title,url,w,h) {
        layer_show(title,url,w,h)
    }


    //删除货仓管理权限
	$('.warehouse-items i').click(function () {
	      var _this = $(this);
		  var userid =_this.data('userid');
		  var warehouse = _this.data('warehouse');

        $.ajax({
            type: 'POST',
            url: '{{:url('/warehouse/remove_manage')}}',
            data:{AllowUser:userid,WareHouse:warehouse},
            dataType: 'json',
            beforeSend:function(){
                layer.msg('加载中...',{time:10000});
            },
            success: function(res){
                 if(res.code==200){
                     _this.parent().remove();
                     layer.msg(res.msg);
				 }else{
                     layer.msg(res.msg);
				 }
            },
            error:function(data) {}
        })


    });
</script>

{include file="common/footer" /}